﻿@model kxcxw.Data.Entities.PublichInformation
@using KXCXW.Web.CommonClass
@{
    ViewBag.Title = "填写促销信息";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/createInfo_Q.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Content/datepicker/WdatePicker.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Content/HtmlEdit/xheditor-1.1.12-zh-cn.min.js")" type="text/javascript"></script>
<script type="text/javascript">
    function Showdelete(picId) {

        document.getElementById(picId).style.display = "none";
        $.post('@Url.Action("DeletePic")',
           {
               id: picId,
               infoid:"@Model.InformationID"
           }
        );
       }

       $(function(){
        $("#ddlRootCategory").change(function(){ 
            var selec = $(this).val();  //获取改变的选项值
            var url = "@Url.Action("QY")";  //参数依次类型(action,Controller,area）
            $("#ItemDeitalID").find("option").remove();  //清空
            $.getJSON(url, { 'ParentID': selec }, function (data) {  
                $.each(data, function (i, item) {
                    $("<option></option>").val(item["Value"]).text(item["Text"]).appendTo($("#ItemDeitalID"));
                });  
            });     
        });
    });
</script>
<div class="page_content">
    @using (Html.BeginForm("Save", "PublishInfo", FormMethod.Post))
    {
        @Html.ValidationSummary(true)
        <fieldset>
            @Html.HiddenFor(model => model.InformationID)
            @Html.HiddenFor(model => model.InfoType)
            @Html.Hidden("ShopUrl", "http://www.kxcxw.com")
            @Html.HiddenFor(model => model.Status)
            @Html.HiddenFor(model => model.PublishID)
            @Html.HiddenFor(model => model.PublishDate)
            <div class="fromcontent">
                <div class="wholetip clear">
                    <h3>
                        修改实体店促销信息</h3>
                </div>
                <div class="field">
                    <div class="editor-label">
                        <span>*</span>标 题：</div>
                    <div class="editor-field-long">
                        @Html.EditorFor(model => model.Title)
                        @Html.ValidationMessageFor(model => model.Title)
                    </div>
                </div>
                <div class="field">
                    <div class="editor-label">
                        <span>*</span>详细地址：
                    </div>
                    <div class="editor-field-long">
                        @Html.EditorFor(model => model.Addres)
                        @Html.ValidationMessageFor(model => model.Addres)
                    </div>
                </div>
                <div class="field">
                    <div class="editor-label">
                        类 别：
                    </div>
                    <div class="editor-field">
                        @Html.DropDownList("ddlRootCategory", (SelectList)ViewBag.rootCategoryList, "请选择类别")
                    </div>
                    <div class="editor-field">
                        @Html.DropDownList("ItemDeitalID", (IEnumerable<SelectListItem>)ViewBag.CategoryList)
                    </div>
                </div>
                <div class="field">
                    <div class="editor-label">
                        促销方式：
                    </div>
                    <div class="editor-field">
                        @Html.DropDownListFor(model => model.PromotionType, (SelectList)ViewBag.PromotionTypeList, new { id = "ddlmothed" })
                    </div>
                    <div class="editor-label">
                        <span>*</span>原 价：
                    </div>
                    <div class="editor-field-small">
                        @Html.EditorFor(model => model.OriginalPrice)
                    </div>
                    <div id="zhekou">
                        <div class="editor-label">
                            <span>*</span>现 价：
                        </div>
                        <div class="editor-field-small">
                            @Html.EditorFor(model => model.PresentPrice)
                        </div>
                        <div class="editor-label">
                            <span>*</span>折 扣：
                        </div>
                        <div class="editor-field-small">
                            @Html.EditorFor(model => model.Discount)
                        </div>
                    </div>
                    <div id="gouzheng" style="display: none;">
                        <div class="editor-label">
                            <span>*</span>赠 品：
                        </div>
                        <div class="editor-field" style="width: 180px;">
                            @Html.EditorFor(model => model.Other)
                        </div>
                    </div>
                </div>
                <div class="field">
                    <div class="editor-label">
                        开始日期：
                    </div>
                    <div class="editor-field">
                        @Html.TextBox("StartDate", Model.StartDate != null ? Convert.ToDateTime(Model.StartDate).ToShortDateString() : "", new { id = "txtStartDate", @class = "Wdate", datatype = "date", onFocus = "WdatePicker({skin: 'whyGreen',isShowWeek:true,minDate:'%y-%M-%d',maxDate:'#F{$dp.$D(\\'txtEndDate\\')}'})" })
                        @Html.ValidationMessageFor(model => model.StartDate)
                    </div>
                    <div class="editor-label">
                        结束日期：
                    </div>
                    <div class="editor-field">
                        @Html.TextBox("EndDate", Model.EndDate != null ? Convert.ToDateTime(Model.EndDate).ToShortDateString() : "", new { id = "txtEndDate", @class = "Wdate", datatype = "date", onFocus = "WdatePicker({skin: 'whyGreen',isShowWeek:true,minDate:'#F{$dp.$D(\\'txtStartDate\\')}',maxDate:''})" })
                        @Html.ValidationMessageFor(model => model.EndDate)
                    </div>
                </div>
                <div class="field">
                    <div class="editor-label">
                        商家名：
                    </div>
                    <div class="editor-field-long">
                        @Html.EditorFor(model => model.BusinessName)
                    </div>
                </div>
                <div class="field">
                    <div class="editor-label">
                        联系电话：
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.Mobile)
                        @Html.ValidationMessageFor(model => model.Mobile)
                    </div>
                    <div class="editor-label">
                        联 系 人：
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.ContactPerson)
                        @Html.ValidationMessageFor(model => model.ContactPerson)
                    </div>
                    <div class="editor-label">
                        QQ或MSN：
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.IM)
                        @Html.ValidationMessageFor(model => model.IM)
                    </div>
                </div>
                <div class="field" style="height: auto;">
                    <div class="editor-label">
                        图 片：
                    </div>
                    <div class="editor-field-long">
                        <div class="thumbnails">
                            @if (!string.IsNullOrEmpty(Model.PictureShow))
                            {
                                foreach (string filename in System.Xml.Linq.XElement.Parse(Model.PictureShow).Elements().ToList())
                                {
                                    if (filename != "")
                                    {
                                <div class="imgbox" id="@filename">
                                    <span>
                                        <img style="margin: 5px; opacity: 1;" src="@Url.Content(ImgHelper.ImgFoldUrl(ImgHelper.img90) + filename)">
                                        <a class="delete" href="javascript:Showdelete('@filename');"></a></span>
                                    @if (filename == Model.MapUrl)
                                    {
                                        <input title="选中后将做为封面" type="radio" name="faceRadio" value="@filename" checked="checked"/>
                                    }
                                    else
                                    {
                                        <input title="选中后将做为封面" type="radio" name="faceRadio" value="@filename"/>
                                    }
                                </div>
                                    }
                                }
                            }
                        </div>
                        @{Html.RenderPartial("_UpLoadPic", Model.InformationID); }
                    </div>
                </div>
                <div style="height: auto; margin-top: 10px;" class="field">
                    <div class="editor-label">
                        详细信息：
                    </div>
                    <div class="editor-field-long">
                        @Html.TextAreaFor(m => m.Desception, new
                   {
                       @class = "xheditor {tools:'Blocktag,Fontface,FontSize,|," +
                           "Bold,Italic,Underline,Strikethrough,|,FontColor,BackColor,SelectAll,Removeformat,|," +
                           "Align,List,Outdent,Indent,|,Link,Unlink,Hr,Anchor,Table,|,Img,|,Fullscreen,Preview'," +
                           "skin:'default',width:'100%',height:'200px',cleanPaste:1," +
                           "upLinkUrl:'/Home/XhUpload',upImgUrl:'/Home/XhUpload?immediate=2',upFlashUrl:'XhEditor/XhUpload',upMediaUrl:'XhEditor/XhUpload' }"
                   })
                    </div>
                </div>
                <p>
                    <input type="submit" class="btn_mid" value="修　　改" />
                </p>
            </div>
        </fieldset>
    }
</div>
